package com.hunau.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Select;

import com.hunau.pojo.Element;

public interface ElementMapper {
	/*
	 * select * from a where id in (select id from b );
	 * 对于这条sql语句它的执行计划其实并不是先查询出b表的所有id,然后再与a表的id进行比较。
	 * mysql会把in子查询转换成exists相关子查询，所以它实际等同于这条sql语句：select * from a where
	 * exists(select * from b where b.id=a.id );
	 */
	@Select("select * from element where id in (select eid from role_element where rid=#{0})")
	List<Element> selByRid(int id);
}
